package com.ponhu.ea2.goodsCenter.provider.config;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;

@Data
@Accessors(chain = true)
public class GenerateDigitVo implements Comparable {

    // 货品编码自增数字位数
    private Integer digit;

    // 配置生效时间，时间格式yyyy-MM-dd(示例：2021-08-08)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE)
    private LocalDate startDate;

    @Override // 按startDate降序排列
    public int compareTo(Object o) {
        GenerateDigitVo digitVo = (GenerateDigitVo) o;
        return digitVo.getStartDate().compareTo(this.startDate);
    }

}
